package thread.learn;

/**
 * @author jiangwz
 * @create 2019/9/30.
 */
public class NoVisibility {
    private static boolean ready;
    private static int number;
    private static class ReaderThread extends Thread {
        public void run() {
            System.out.println("b-"+ready);
            while (!ready) {
                System.out.println("--");
                Thread.yield();
            }
            System.out.println("a-"+ready);
        }
    }
    public static void main(String[] args) {
        System.out.println(ready);
        new ReaderThread().start();
        number = 42;
        ready = true;
    }
}